#include <bits/stdc++.h>
using namespace std;
struct S {
  int id;
  int rank;
  int ch, math, en;
  int sum3;
  int sum2;
  int maxx;
};
S s[10001];
bool cmp(S a, S b) {
  if (a.sum3 > b.sum3)
    return true;
  else if (a.sum3 == b.sum3 && a.sum2 > b.sum2)
    return true;
  else if (a.sum3 == b.sum3 && a.sum2 == b.sum2 && a.maxx > b.maxx)
    return true;

  return false;
}

bool cmp2(S a, S b) { return (a.id < b.id); }

int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> s[i].ch >> s[i].math >> s[i].en;
    s[i].id = i;
    s[i].sum2 = s[i].ch + s[i].math;
    s[i].sum3 = s[i].ch + s[i].math + s[i].en;
    s[i].maxx = max(s[i].ch, s[i].math);
  }
  sort(s + 1, s + n + 1, cmp);

  s[1].rank = 1;
  for (int i = 2; i <= n; i++) {
    if (s[i].sum3 == s[i - 1].sum3 && s[i].sum2 == s[i - 1].sum2 &&
        s[i].maxx == s[i - 1].maxx) {
      s[i].rank = s[i - 1].rank;
    } else
      s[i].rank = i;
  }

  sort(s + 1, s + n + 1, cmp2);
  for (int i = 1; i <= n; i++) {
    cout << s[i].rank << endl;
  }

  return 0;
}